package ModelLag;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class DVDContainerTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */

public class DVDContainerTest
{
    private DVDContainer dCon;
    private DVD d1,d2,d3;
    /**
     * Default constructor for test class DVDContainerTest
     */
    public DVDContainerTest()
    {
        
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
    }
    
    @Test
    public void testIfDVDAdded(){
        dCon = DVDContainer.getInstance();
        d1 = new DVD("1", "Rambo III", "Sylvester Stallone", "1990");
        
        dCon.addDVD(d1);
        
        assertSame(d1, dCon.findDVD("1"));
       
        
    }
    
    @Test
    public void testIfMultipleDVDAdded(){
        dCon = DVDContainer.getInstance();
        d1 = new DVD("1", "Rambo III", "Sylvester Stallone", "1990");
        d2 = new DVD("2", "Die Hard", "Bruce Willis", "2000");
        d3 = new DVD("3", "Blood Sport", "Jean Claude Van Damme", "2010");
        
        dCon.addDVD(d1);
        dCon.addDVD(d2);
        dCon.addDVD(d3);
        
        assertSame(d2, dCon.findDVD("2"));
    }
    
    @Test
    public void testIfNoDVDAdded(){
        dCon = DVDContainer.getInstance();
        
        assertEquals(null, dCon.findDVD("2"));
        
    }
    
    @Test
    public void testIfDVDDeleted(){
        dCon = DVDContainer.getInstance();
        d1 = new DVD("1", "Rambo III", "Sylvester Stallone", "1990");
        
        dCon.addDVD(d1);
        dCon.deleteDVD("1");
        
        assertSame(null, dCon.findDVD("1"));
    }
    
    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
        dCon.deleteDVD("1");
        dCon.deleteDVD("2");
        dCon.deleteDVD("3");
    }
}
